//package com.fortune.integration;
//
//import com.aliyuncs.CommonRequest;
//import com.aliyuncs.CommonResponse;
//import com.aliyuncs.IAcsClient;
//import com.aliyuncs.exceptions.ClientException;
//import com.aliyuncs.exceptions.ServerException;
//import com.aliyuncs.http.MethodType;
//import com.chengwei.mall.client.dto.SMSDTO;
//import com.chengwei.mall.client.dto.SMSResponse;
//import com.chengwei.mall.exception.MallException;
//import com.google.gson.Gson;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//@Component
//@Slf4j
//public class SMSSendClient {
//
//	@Autowired
//	Gson gson;
//
//	@Autowired
//	IAcsClient iAcsClient;
//
//	public boolean sendSms(String phone,String code) {
//		SMSResponse response1 = new SMSResponse();
//		String templateParam = gson.toJson(new SMSDTO(code));
//		CommonRequest request = new CommonRequest();
//		request.setMethod(MethodType.POST);
//		request.setDomain("dysmsapi.aliyuncs.com");
//		request.setVersion("2017-05-25");
//		request.setAction("SendSms");
//		request.putQueryParameter("RegionId", "cn-hangzhou");
//		request.putQueryParameter("PhoneNumbers", phone);
//		request.putQueryParameter("SignName", "云商城注册");
//		request.putQueryParameter("TemplateCode", "SMS_188510092");
//		request.putQueryParameter("TemplateParam", templateParam);
//		try {
//			CommonResponse response = iAcsClient.getCommonResponse(request);
//			response1 = gson.fromJson(response.getData(), SMSResponse.class);
//			if (response1.getCode().equals("OK")) {
//				return true;
//			}else{
//				throw new MallException(response1.getMessage());
//			}
//		} catch (ServerException e) {
//			e.printStackTrace();
//		} catch (ClientException e) {
//			e.printStackTrace();
//		}
//		return false;
//	}
//}
